package cn.iocoder.yudao.module.lfd.dal.mysql.barber;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.lfd.dal.dataobject.barber.BarberDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.lfd.controller.admin.barber.vo.*;

/**
 * 理发师 Mapper
 *
 * @author 芋道源码
 */
@Mapper
public interface BarberMapper extends BaseMapperX<BarberDO> {

    default PageResult<BarberDO> selectPage(BarberPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<BarberDO>()
                .eqIfPresent(BarberDO::getPassword, reqVO.getPassword())
                .eqIfPresent(BarberDO::getPhone, reqVO.getPhone())
                .eqIfPresent(BarberDO::getBirthday, reqVO.getBirthday())
                .betweenIfPresent(BarberDO::getCreateTime, reqVO.getCreateTime())
                .likeIfPresent(BarberDO::getNickName, reqVO.getNickName())
                .eqIfPresent(BarberDO::getSex, reqVO.getSex())
                .eqIfPresent(BarberDO::getShopId, reqVO.getShopId())
                .eqIfPresent(BarberDO::getSort, reqVO.getSort())
                .eqIfPresent(BarberDO::getAvatar, reqVO.getAvatar())
                .eqIfPresent(BarberDO::getWorks, reqVO.getWorks())
                .orderByDesc(BarberDO::getId));
    }

    default List<BarberDO> selectList(BarberExportReqVO reqVO) {
        return selectList(new LambdaQueryWrapperX<BarberDO>()
                .eqIfPresent(BarberDO::getPassword, reqVO.getPassword())
                .eqIfPresent(BarberDO::getPhone, reqVO.getPhone())
                .eqIfPresent(BarberDO::getBirthday, reqVO.getBirthday())
                .betweenIfPresent(BarberDO::getCreateTime, reqVO.getCreateTime())
                .likeIfPresent(BarberDO::getNickName, reqVO.getNickName())
                .eqIfPresent(BarberDO::getSex, reqVO.getSex())
                .eqIfPresent(BarberDO::getShopId, reqVO.getShopId())
                .eqIfPresent(BarberDO::getSort, reqVO.getSort())
                .eqIfPresent(BarberDO::getAvatar, reqVO.getAvatar())
                .eqIfPresent(BarberDO::getWorks, reqVO.getWorks())
                .orderByDesc(BarberDO::getId));
    }

}
